From b29a1d0f7eef9a611bf5bb2b89b1e0f6cea41f41 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 26 Dec 2005 07:52:43 +0000 Subject: [PATCH] Mention the stripping of (_F) suffixes. 2005-12-26 Matthias Clasen * README.in: Mention the stripping of (_F) suffixes. * gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): Strip a suffix of the form " (_)", since this is the preferred way for some languages to indicate accelerators. (#323956, Yang Hong) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ README.in | 4 ++++ gtk/gtktoolbar.c | 16 ++++++++++++++-- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a71fbc6cd..7523f9a64a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2005-12-26 Matthias Clasen + * README.in: Mention the stripping of (_F) suffixes. + + * gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): Strip a suffix of + the form " (_)", since this is the preferred way + for some languages to indicate accelerators. (#323956, Yang Hong) + * gtk/gtklabel.c (gtk_label_class_init): Add a gtk-label-select-on-focus setting. (gtk_label_grab_focus): And use it here to select the contents of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9a71fbc6cd..7523f9a64a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,11 @@ 2005-12-26 Matthias Clasen + * README.in: Mention the stripping of (_F) suffixes. + + * gtk/gtktoolbar.c (_gtk_toolbar_elide_underscores): Strip a suffix of + the form " (_)", since this is the preferred way + for some languages to indicate accelerators. (#323956, Yang Hong) + * gtk/gtklabel.c (gtk_label_class_init): Add a gtk-label-select-on-focus setting. (gtk_label_grab_focus): And use it here to select the contents of diff --git a/README.in b/README.in index f6904570e2..8fd13afedb 100644 --- a/README.in +++ b/README.in @@ -48,6 +48,10 @@ Release notes for 2.10 reference. Details about floating references can be found in the docs: http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#floating-ref +* Suffixes like (_F) are now stripped from labels when they are displayed + in toolbars. If this is not wanted, the feature can be suppressed by + inserting a Unicode control character, e.g ZWNJ. + Release notes ============= diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index a40aa3b458..712b0e3c9e 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -4876,11 +4876,13 @@ _gtk_toolbar_elide_underscores (const gchar *original) gchar *q, *result; const gchar *p; gboolean last_underscore; + gint s; if (!original) return NULL; - q = result = g_malloc (strlen (original) + 1); + s = strlen (original); + q = result = g_malloc (s + 1); last_underscore = FALSE; for (p = original; *p; p++) @@ -4893,8 +4895,18 @@ _gtk_toolbar_elide_underscores (const gchar *original) *q++ = *p; } } - + *q = '\0'; + + if (s > 4) + { + if (original[s - 5] == ' ' && + original[s - 4] == '(' && + original[s - 3] == '_' && + original[s - 1] == ')') + q[-4] = '\0'; + } + return result; } -- 2.30.2